package com.own.business.resource.core.property;

import com.own.business.resource.core.em.ResourceGlobalUniqueEnum;
import com.own.constant.ConstantValue;
import lombok.Data;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * ResourceProperty
 *
 * @author chenxueli
 * @date 2023-07-07 13:56:21
 */
@Data
@ConfigurationProperties(prefix = ResourceProperty.PREFIX)
@SpringBootConfiguration
public class ResourceProperty {

    public static final String PREFIX = ConstantValue.CONFIG_VALUE_CONTENT + "resource";

    /**
     * 默认的方式 default
     */
    private String primary = "default";

    /**
     * 文件唯一策略
     */
    private ResourceGlobalUniqueEnum unique = ResourceGlobalUniqueEnum.NEXT;

    /**
     * 默认的配置，默认名称为default
     */
    @NestedConfigurationProperty
    private ResourceSourceProperty source;

    /**
     * 保存处理
     */
    @NestedConfigurationProperty
    private ResourceSaveHandlerProperty saveHandler = ResourceSaveHandlerProperty.DEFAULT;

    /**
     * 每一个方式的配置信息
     */
    private Map<String, ResourceSourceProperty> multipleSource = new LinkedHashMap<>();

}
